Page({
  data: {
    referenceImageBeforeStarting: [

    ],
    referenceImagesFromClient: [{
        id: '1',
        src: '../../images/reference_images_from_client_01.png'
      },
      {
        id: '2',
        src: '../../images/reference_images_from_client_02.png'
      },
      {
        id: '3',
        src: '../../images/reference_images_from_client_03.png'
      },
      {
        id: '4',
        src: '../../images/reference_images_from_client_04.png'
      },
      {
        id: '5',
        src: '../../images/reference_images_from_client_05.png'
      }
    ],
    expressImage: [

    ],
    acceptanceCheckImageList: [

    ],
    currentTab: 0,
    clientHeight: 'auto'
  },
  onLoad: function() {
    var res = wx.getSystemInfoSync();
    var clientHeight = ((res.windowHeight * 2) - 234) + 'rpx';
    this.setData({
      clientHeight: clientHeight
    })
  },
  stopTouchMove: function () {
    return false;
  },
  clickTab: function(e) {
    var res = wx.getSystemInfoSync();
    var clientHeight = ((res.windowHeight * 2) - 234) + 'rpx';
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      this.setData({
        currentTab: e.target.dataset.current,
        clientHeight: clientHeight
      })
    }
  },
  addImages: function(e) {
    /*wx.chooseImage({
      count:9,
      sizeType: ['original', 'compressed'],
      sourceType: ['album','camera'],
      success: function(res) {
        var tempFilePaths = res.tempFilePaths;
        console.log(tempFilePaths)
        wx.previewImage({
          current: res.tempFilePaths[0],
          urls: res.tempFilePaths
        })
      }
    })
  }*/
    wx.showActionSheet({
      itemList: [
        '拍摄10秒短视频',
        '拍照',
        '从手机相册选择',
      ],
      success: function (res) {
        console.log(res.tapIndex)
        if (res.tapIndex === 0) {
          wx.chooseVideo({
            sourceType: ['camera', 'album'],
            maxDuration: 10,
            camera: 'back',
            success: function (res) {
              console.log(res.tempFilePath)
            }
          })
        } else if (res.tapIndex === 1) {
          wx.chooseImage({
            count: 3,
            sizeType: ['original', 'compressed'],
            sourceType: ['camera'],
            success: function (res) {
              var tempFilePaths = res.tempFilePaths;
              wx.previewImage({
                current: res.tempFilePaths[0],
                urls: res.tempFilePaths
              })
            },
          })
        } else if (res.tapIndex === 2) {
          wx.chooseImage({
            count: 3,
            sizeType: ['original', 'compressed'],
            sourceType: ['album'],
            success: function (res) {
              var tempFilePaths = res.tempFilePaths;
              wx.previewImage({
                current: res.tempFilePaths[0],
                urls: res.tempFilePaths
              })
            },
          })
        }
      },
      fail: function (res) {
        console.log(res.errMsg)
      }
    })
  },
  gotoDismissedSuggestions: function(){
    wx.navigateTo({
      url: '../dismissedSuggestions/dismissedSuggestions'
    })
  },
  gotoWaitingForAcceptance: function () {
    wx.navigateTo({
      url: '../waitingForAcceptance/waitingForAcceptance'
    })
  }
})